<<<<<<< .mine
﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LogicUniversityBiz;

namespace LogicUniversity.Representative
{
    public partial class CheckRequestedItem : System.Web.UI.Page
    {
        private CheckRequestedItemsControl control;
        protected void Page_PreInit(Object sender, EventArgs e)
        {
            //(Session["Role"]
            if (Session["Role"] as string != "Representative")
            {
                Response.Redirect("../Login.aspx");
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            
            if (!IsPostBack)
            {
                control = new CheckRequestedItemsControl();
                DayMatcher matcher = new DayMatcher(new DateTime(2013,9,22));

                //lblFromDate.Text = matcher.calculateFromDate().ToShortDateString();
                //lblToDate.Text = matcher.calculateToDate().ToShortDateString();

                //to retrieve empid from Session
                string deptCode = control.getDeptCodeOf(Session["UserID"] as string);

                List<TotalRequestedItems> totalItems = control.getTotalWeeklyRequestedItems(System.DateTime.Today,deptCode);

                if (totalItems == null || totalItems.Count <= 0)
                {
                    lblMsg.Text = "Currently No Requested Items";
                    btn.Visible = false;
                }
                TotalItemsView.DataSource = totalItems;
                TotalItemsView.DataBind();
            }
        }

        protected void btn_Click(object sender, EventArgs e)
        {
            List<string> itemCodes=new List<string>();
            control = new CheckRequestedItemsControl();
            foreach (GridViewRow row in TotalItemsView.Rows)
            {
                itemCodes.Add(row.Cells[0].Text.Trim());
            }

            string deptCode = control.getDeptCodeOf(Session["UserID"] as string);
            control.acknowledge(itemCodes, Session["UserID"] as string,deptCode);
            
            List<TotalRequestedItems> totalItems = control.getTotalWeeklyRequestedItems(System.DateTime.Today, deptCode);
            TotalItemsView.DataSource = totalItems;
            TotalItemsView.DataBind();

            lblMsg.Text = "Requested Items has been received";
            btn.Visible = false;
        }
    }
}=======
﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LogicUniversityBiz;

namespace LogicUniversity.Representative
{
    public partial class CheckRequestedItem : System.Web.UI.Page
    {
        private CheckRequestedItemsControl control;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                control = new CheckRequestedItemsControl();
                DayMatcher matcher = new DayMatcher(new DateTime(2013,9,22));

                lblFromDate.Text = matcher.calculateFromDate().ToShortDateString();
                lblToDate.Text = matcher.calculateToDate().ToShortDateString();

                //to retrieve from Session, department code
                string deptCode="Sci";

                List<RequisitionWithItemDetails> totalItems = control.getTotalWeeklyRequestedItems(System.DateTime.Today,deptCode);

                TotalItemsView.DataSource = totalItems;
                TotalItemsView.DataBind();
            }
        }
    }
}>>>>>>> .r28
